package sv.edu.edutec.fotos.model;

// Generated 12-11-2013 10:21:09 AM by Hibernate Tools 3.4.0.CR1

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * TblUser generated by hbm2java
 */
@Entity
@Table(name = "tbl_user")
public class TblUser implements java.io.Serializable {

	private int userId;
	private String username;
	private String password;
	private Set<TblRoles> tblRoleses = new HashSet(0);
	private Set<TblComment> tblComments = new HashSet(0);

	public TblUser() {
	}

	public TblUser(int userId) {
		this.userId = userId;
	}

	public TblUser(int userId, String username, String password,
			Set tblRoleses, Set tblComments) {
		this.userId = userId;
		this.username = username;
		this.password = password;
		this.tblRoleses = tblRoleses;
		this.tblComments = tblComments;
	}

	@Id
	@Column(name = "user_id", unique = true, nullable = false)
	public int getUserId() {
		return this.userId;
	}

	public void setUserId(int userId) {
		this.userId = userId;
	}

	@Column(name = "username")
	public String getUsername() {
		return this.username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	@Column(name = "password")
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "tbl_user_has_roles", joinColumns = { @JoinColumn(name = "tbl_user_user_id", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "tbl_roles_role_id", nullable = false, updatable = false) })
	public Set<TblRoles> getTblRoleses() {
		return this.tblRoleses;
	}

	public void setTblRoleses(Set<TblRoles> tblRoleses) {
		this.tblRoleses = tblRoleses;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "tblUser")
	public Set<TblComment> getTblComments() {
		return this.tblComments;
	}

	public void setTblComments(Set<TblComment> tblComments) {
		this.tblComments = tblComments;
	}

}
